package com.lx.demo.b.core.logback;

import ch.qos.logback.classic.PatternLayout;
import ch.qos.logback.core.status.OnConsoleStatusListener;

import java.io.PrintStream;

/**
 * Created by lanyxp on 2020/7/17
 */
public class AppInitStatusLister extends OnConsoleStatusListener {
    private volatile boolean init;
    @Override
    protected PrintStream getPrintStream() {
        if (!init) {
            init = true;
            doStartInit();
        }
        return super.getPrintStream();
    }
    protected void doStartInit() {
        PatternLayout.defaultConverterMap.put("m", LogSensitiveConverter.class.getName());
        PatternLayout.defaultConverterMap.put("msg", LogSensitiveConverter.class.getName());
    }
}
